<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="./../home.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui">
    <ui:define name="content" >
        <div class="col-lg-12">
            <h3 class="page-header" id="perros">
                Administracion de Alarmas
            </h3>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <h:form id="listAlarmas">
                            <f:event type="preRenderView" listener="#{alarmaBean.initLista}" />
                            <p:dataTable value="#{alarmaBean.alarmas}" var="list" 
                                         paginator="true" rows="10" lazy="true" rowIndexVar="rowIndex" emptyMessage="No existen registros de alarmas"
                                         paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}" >
                                <p:column style="text-align: center; width: 5%;" >
                                    <f:facet name="header">
                                        #
                                    </f:facet>
                                    <h:outputText value="#{rowIndex+1}" />
                                </p:column>
                                <p:column headerText="Evento" style="text-align: center;width: 75%;white-space: normal;">
                                    <h:outputText value="#{list.evento.nombre}" />
                                </p:column>
                                <p:column headerText="Estado" style="text-align: center;width: 15%;">
                                    <h:panelGroup rendered="#{list.activo eq true}"> 
                                        <h:outputText value="Activado" />
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{list.activo eq false}"> 
                                        <h:outputText value="Desactivado" />
                                    </h:panelGroup>
                                </p:column>
                                <p:column  style="text-align: center;width: 5%;">
                                    <h:panelGroup rendered="#{usuarioBean.permiso.actualizar eq true}">
                                        <p:commandButton icon="icon-update"  action="#{alarmaBean.irActualizar(list.idAlarma)}" />
                                    </h:panelGroup>
                                </p:column>
                            </p:dataTable>
                        </h:form>
                        
                    </div>
                </div>
            </div>
        </div>
    </ui:define>
</ui:composition>

